package com.rtx.model.po.service.impl;

import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rtx.api.annotation.DataSourceAnnotation;
import com.rtx.model.po.entity.system.MenuPermission;
import com.rtx.model.po.mapper.MenuPermissionMapper;
import com.rtx.model.po.service.MenuPermissionDAO;

@Component
public class MenuPermissionDAOImpl extends ServiceImpl<MenuPermissionMapper, MenuPermission> implements MenuPermissionDAO {

	@DataSourceAnnotation
	@Override
	public void selectPage(String datasourcekey,Page<MenuPermission> page, LambdaQueryWrapper<MenuPermission> qw) {
		baseMapper.selectPage(page, qw);
	}

	@DataSourceAnnotation
	@Override
	public int insertMenuPermission(String datasourcekey, MenuPermission menuPermission) {
		return baseMapper.insert(menuPermission);
	}

	@DataSourceAnnotation
	@Override
	public void updateMenuPermission(String datasourcekey, MenuPermission menuPermission) {
		baseMapper.updateById(menuPermission);
	}

	@DataSourceAnnotation
	@Override
	public List<MenuPermission> selectMenuPermissionByQueryCondition(String datasourcekey, LambdaQueryWrapper<MenuPermission> qw) {
		return baseMapper.selectList(qw);
	}

	@DataSourceAnnotation
	@Override
	public int deleteMenuPermissionById(String datasourcekey, Long id) {
		return baseMapper.deleteById(id);
	}

	@DataSourceAnnotation
	@Override
	public int batchDeleteMenuPermissionByIds(String datasourcekey, Long[] ids) {
		return baseMapper.deleteBatchIds(Arrays.asList(ids));
	}
	
	
}
